home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-09-17 | 5.4 KB | 174 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: FWStatic.h
- // Release Version: $ ODF 2 $
- //
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
-
- #ifndef FWSTATIC_H
- #define FWSTATIC_H
-
- #ifndef FWVIEW_H
- #include "FWView.h"
- #endif
-
- #ifndef FWSTRING_H
- #include "FWString.h"
- #endif
-
- #ifndef FWTXTBOX_H
- #include "FWTxtBox.h"
- #endif
-
- //========================================================================================
- // Forward Declarations
- //========================================================================================
-
- //========================================================================================
- // class FW_CStaticText
- //========================================================================================
-
- class FW_CStaticText: public FW_CView
- {
- public:
- FW_DECLARE_CLASS
- FW_DECLARE_AUTO(FW_CStaticText)
-
- //----------------------------------------------------------------------------------------
- // Initialization/Destruction
- //
- FW_CStaticText(Environment* ev,
- FW_CSuperView* container,
- const FW_CRect& bounds,
- ODID viewID,
- const FW_CString& text,
- const FW_CFont& font = FW_kNormalFont,
- FW_TextBoxOptions options = FW_kTextBoxClipToBox,
- const FW_CInk& ink = FW_kNormalTextInk);
-
- FW_CStaticText(Environment* ev,
- FW_CSuperView* container,
- ODID viewID,
- const FW_CTextBoxShape& textboxshape);
-
- FW_CStaticText(Environment* ev);
-
- ~FW_CStaticText();
-
- //----------------------------------------------------------------------------------------
- // New API
- //
- void GetText(Environment* ev, FW_CString& text) const;
- void SetText(Environment* ev, const FW_CString& text, FW_ERedrawVerb redraw = FW_kInvalidate);
- FW_CTextBoxShape* GetTextBoxShape(Environment* ev);
-
- void SetEraseColor(const FW_CColor& eraseColor);
-
- //----------------------------------------------------------------------------------------
- // FW_CView API
- //
- virtual void Draw (Environment* ev, ODFacet* facet, ODShape* invalidShape);
-
- //----------------------------------------------------------------------------------------
- // Archiving
- //
- static void* Create(FW_CReadableStream& stream, FW_ClassTypeConstant type);
- static void Destroy(void* object, FW_ClassTypeConstant type);
- virtual void Flatten(Environment* ev, FW_CWritableStream& stream) const;
- virtual void InitializeFromStream(Environment* ev, FW_CReadableStream& stream);
-
- private:
- void Initialize(Environment* ev,
- const FW_CRect& bounds,
- const FW_CString& text,
- const FW_CFont& font,
- FW_TextBoxOptions options,
- const FW_CInk& ink);
- private:
- FW_CTextBoxShape* fTextBoxShape;
- FW_CColor fEraseColor;
- FW_Boolean fEraseOnDraw;
- };
-
- //----------------------------------------------------------------------------------------
- // FW_CStaticText::GetTextBoxShape
- //----------------------------------------------------------------------------------------
- inline FW_CTextBoxShape* FW_CStaticText::GetTextBoxShape(Environment*)
- {
- return fTextBoxShape;
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CStaticText::GetText
- //----------------------------------------------------------------------------------------
- inline void FW_CStaticText::GetText(Environment*, FW_CString& text) const
- {
- fTextBoxShape->GetString(text);
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CStaticText::SetEraseColor
- //----------------------------------------------------------------------------------------
- inline void FW_CStaticText::SetEraseColor(const FW_CColor& eraseColor)
- {
- fEraseColor = eraseColor;
- }
-
- //========================================================================================
- // class FW_CGroupBox
- //========================================================================================
-
- class FW_CGroupBox: public FW_CStaticText
- {
- public:
- FW_DECLARE_CLASS
- FW_DECLARE_AUTO(FW_CGroupBox)
-
- FW_CGroupBox (Environment* ev,
- FW_CSuperView* container,
- const FW_CRect& bounds,
- ODID viewID,
- const FW_CString& text,
- const FW_CFont& font = FW_kNormalFont,
- FW_TextBoxOptions options = FW_kTextBoxClipToBox,
- const FW_CInk& textInk = FW_kNormalTextInk,
- const FW_CInk& frameInk = FW_kNormalInk);
-
- FW_CGroupBox (Environment* ev,
- FW_CSuperView* container,
- ODID viewID,
- const FW_CTextBoxShape& textbox,
- const FW_CInk& frameInk = FW_kNormalInk);
-
- FW_CGroupBox(Environment* ev);
-
- ~FW_CGroupBox();
-
- //----------------------------------------------------------------------------------------
- // FW_CView API
- //
- virtual void Draw (Environment* ev, ODFacet* facet, ODShape* invalidShape);
-
- //----------------------------------------------------------------------------------------
- // Archiving
- //
- static void* Create(FW_CReadableStream& stream, FW_ClassTypeConstant type);
- static void Destroy(void* object, FW_ClassTypeConstant type);
- virtual void Flatten(Environment* ev, FW_CWritableStream& stream) const;
- virtual void InitializeFromStream(Environment* ev, FW_CReadableStream& stream);
-
- protected:
- void SetLabelRect(Environment* ev, FW_CGraphicContext& gc, FW_CRect& rect);
-
- private:
- FW_CInk fFrameInk;
- };
-
-
- #endif
-
-
-